<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class Test extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'wbz:test';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {


        $sdk = new \App\Admin\SDK\IBay\Order();

        if(!$sdk->getOrderDetail('3788032')) {
            return  \Log::info($sdk->debug());
        }

        \Log::info(json_encode($sdk->response()));
        return 1;



        if(!$sdk->listOrders('2021-01-01', '2021-01-02', 'created', '7')) {

            return  \Log::info($sdk->debug());
        }

        $obj = $sdk->response();
        $list = $obj->listordersResponse->orderv2;
        \Log::info(json_encode($list));

        return 1;

        $page= $_REQUEST['page'] ?? 1;
        $page_size = 200;

        $sdk = new \App\Admin\SDK\IBay\Sku();
        do {

            if(!$sdk->getSkus($page_size, $page)) {

               return  \Log::info($sdk->debug());
            }

            $obj = $sdk->response();
            $list = $obj->getskusResponse->list;

            \Log::info(json_encode($list));
            \Log::info(count($list));

            return 1;

            $page++;

        } while (count($list) == $page_size);


        \Log::info('任务调度测试ok---'.$page);
    }
}
